package cc.iotkit.data.service;

import cc.iotkit.common.api.Paging;
import cc.iotkit.data.mapper.IJPACommData;
import cc.iotkit.data.manager.IDeviceGroupData;
import cc.iotkit.data.model.TbDeviceGroup;
import cc.iotkit.model.device.DeviceGroup;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Primary
@Service
public class DeviceGroupDataImpl implements IDeviceGroupData, IJPACommData<DeviceGroup, String, TbDeviceGroup> {

    @Resource
    private DeviceGroupService deviceGroupService;

    @Override
    public DeviceGroupService getBaseRepository() {
        return deviceGroupService;
    }

    @Override
    public Class getJpaRepositoryClass() {
        return TbDeviceGroup.class;
    }

    @Override
    public Class getTClass() {
        return DeviceGroup.class;
    }

    @Override
    public Paging<DeviceGroup> findByNameLike(String name, int page, int size) {
        return deviceGroupService.findByNameLike(name, page, size);
    }
}
